﻿using System;
using System.Text;
namespace CSharp核心1
{
	//class Person
	//{
	//	public Person()
	//	{
	//		//Console.WriteLine("Person()");
	//	}
	//	~Person()
	//	{
	//		Console.WriteLine("~Person()");
	//		System.Threading.Thread.Sleep(1000);
	//	}

	//	private string name_;
	//	public string Name
	//	{
	//		get { return name_; }
	//		set { name_ = value;}
	//	}
	//}
	//class Student
	//{
	//	private string name_;
	//	private string gender_;
	//	private int age_;
	//	private float score1_;
	//	private float score2_;
	//	public Student[] friends_;
	//	private int friendCount_ = 10;
	//	public Student(string name = "默认", string gender = "男", int age = 18, float score1 = 0, float score2 = 0)
	//	{
	//		Name = name;
	//		Gender = gender;
	//		Age = age;
	//		Score1 = score1;
	//		Score2 = score2;
	//		friends_ = new Student[friendCount_];
	//		classmates_ = new Student[rowCount_, colCount_];
	//	}
	//	public int FriendCount {
	//		get;
	//	}
	//	public Student this[int pos]
	//	{
	//		get
	//		{
	//			if (pos >= 0 && pos < friendCount_)
	//				return friends_[pos];
	//			else
	//			{
	//				Console.WriteLine("索引越界！");
	//				return null;
	//			}
	//		}
	//		set
	//		{
	//			if (pos >= 0 && pos < friendCount_)
	//				friends_[pos] = value;
	//			else Console.WriteLine("索引越界！");
	//		}
	//	}
	//	public Student[,] classmates_;
	//	private int rowCount_ = 5;
	//	private int colCount_ = 5;
	//	public int RowCount
	//	{
	//		get; 
	//	}
	//	public int ColCount
	//	{
	//		get; 
	//	}
	//	public Student this[int row, int col]
	//	{
	//		get
	//		{
	//			if (row >= 0 && row < friendCount_ && col >= 0 && col < friendCount_)
	//				return classmates_[row, col];
	//			else
	//			{
	//				Console.WriteLine("索引越界！");
	//				return null;
	//			}
				
	//		}
	//		set
	//		{
	//			if (row >= 0 && row < friendCount_ && col >= 0 && col < friendCount_)
	//				classmates_[row, col] = value;
	//			else Console.WriteLine("索引越界！");
	//		}
	//	}
	//	public string Name { get; set; }
	//	public string Gender { 
	//		get { return gender_; }
	//		set
	//		{
	//			if(value == "男" || value == "女")
	//				gender_ = value;
	//			else Console.WriteLine("性别输入有误！");
	//		}
	//	}
	//	public int Age { 
	//		get { return age_; }
	//		set
	//		{
	//			if(value >= 0 && value <= 150)
	//				age_ = value;
	//			else Console.WriteLine("年龄输入有误！");
	//		}
	//	}
	//	public float Score1 { 
	//		get { return score1_; }
	//		set {
	//			if (value >= 0 && value <= 100)
	//				score1_ = value;
	//			else Console.WriteLine("C#分数输入有误！");
	//		}
	//	}
	//	public float Score2 {
	//		get { return score2_; }
	//		set
	//		{
	//			if (value >= 0 && value <= 100)
	//				score2_ = value;
	//			else Console.WriteLine("Unity分数输入有误！");
	//		}
	//	}
	//	public void Hello()
	//	{
	//		Console.WriteLine("{0}今年{1}岁了，是{2}同学", Name, Age, Gender);
	//	}
	//	public void ShowScore()
	//	{
	//		float sum = Score1 + Score2;
	//		float avg = 0;
			
	//		avg = sum / 2;
	//		Console.WriteLine("{0}同学的总分是{1}，平均分时{2}。", Name, sum, avg);
	//	}
	//}

	//struct Student
	//{
	//	private string name_;
	//	public Student[] friends_;
	//	private int friendCount_;
	//	public Student(string name = "默认")
	//	{
	//		name_ = name;
	//		friendCount_ = 10;
	//		rowCount_ = 5;
	//		colCount_ = 5;
	//		Name = name;
	//		FriendCount = 10;
	//		friends_ = new Student[FriendCount];
	//		RowCount = 5;
	//		ColCount = 5;
	//		classmates_ = new Student[RowCount, ColCount];
	//	}
	//	public int FriendCount
	//	{
	//		get;
	//		private set;
	//	}
	//	public Student this[int pos]
	//	{
	//		get
	//		{
	//			if (pos < 0 || pos >= 10)
	//			{
	//				Console.WriteLine("索引越界！");
	//				Environment.Exit(-1);
	//			}
	//			return friends_[pos];
	//		}
	//		set
	//		{
	//			if (pos < 0 || pos >= 10)
	//			{
	//				Console.WriteLine("索引越界！");
	//				Environment.Exit(-1);
	//			}
	//			friends_[pos] = value;
	//		}
	//	}
	//	public Student[,] classmates_;
	//	private int rowCount_;
	//	private int colCount_;
	//	public int RowCount
	//	{
	//		get;
	//		private set;
	//	}
	//	public int ColCount
	//	{
	//		get;
	//		private set;
	//	}
	//	public Student this[int row, int col]
	//	{
	//		get
	//		{
	//			if (row < 0 || row >= 5 || col < 0 || col >= 5)
	//			{
	//				Console.WriteLine("索引越界！");
	//				Environment.Exit(-1);
	//			}
	//			return classmates_[row, col];
	//		}
	//		set
	//		{
	//			if (row < 0 || row >= 5 || col < 0 || col >= 5)
	//			{
	//				Console.WriteLine("索引越界！");
	//				Environment.Exit(-1);
	//			}
	//			classmates_[row, col] = value;
	//		}
	//	}
	//	public string Name { get; set; }
	//}

	struct Student
	{
		private string name_;
		private int friendCount_;
		public Student[] friends_;
		public int FriendCount { get; private set; }
		public Student[,] classmates_;
		private int rowCount_;
		private int colCount_;
		public int RowCount { get; private set; }
		public int ColCount { get; private set; }
		public string Name { get; set; }

		public Student(string name = "默认")
		{
			Console.WriteLine("public Student(string name = '默认'");
			name_ = name;
			FriendCount = 10;
			friends_ = new Student[FriendCount];
			RowCount = 5;
			ColCount = 5;
			classmates_ = new Student[RowCount, ColCount];
			Name = name;
			rowCount_ = 5;
			colCount_ = 5;
			friendCount_ = 10;
		}

		public Student this[int pos]
		{
			get
			{
				Console.WriteLine("public Student this[int pos] get");
				if (pos < 0 || pos >= FriendCount)
				{
					Console.WriteLine("索引越界！");
					Environment.Exit(-1);
				}
				return friends_[pos];
			}
			set
			{
				Console.WriteLine("public Student this[int pos] set");
				if (pos < 0 || pos >= FriendCount)
				{
					Console.WriteLine("索引越界！");
					Environment.Exit(-1);
				}
				friends_[pos] = value;
			}
		}

		public Student this[int row, int col]
		{
			get
			{
				Console.WriteLine("public Student this[int row, int col] get");
				if (row < 0 || row >= RowCount || col < 0 || col >= ColCount)
				{
					Console.WriteLine("索引越界！");
					Environment.Exit(-1);
				}
				return classmates_[row, col];
			}
			set
			{
				Console.WriteLine("public Student this[int row, int col] set");
				if (row < 0 || row >= RowCount || col < 0 || col >= ColCount)
				{
					Console.WriteLine("索引越界！");
					Environment.Exit(-1);
				}
				classmates_[row, col] = value;
			}
		}
	}

	struct Position
	{
		public int x_;
		public int y_;
		public Position(int x = 0, int y = 0)
		{
			Console.WriteLine("Position(int x = 0, int y = 0)");
			x_ = x;
			y_ = y;
		}
	}

	class MyArray
	{
		private int[] arr_;
		private int size_;
		private int capacity_;
		
		public MyArray()
		{
			 Console.WriteLine("MyArray()");
			capacity_ = 0;
			size_ = 0;
			arr_ = new int[size_];
		}
		public int Size
		{
			get;
			private set;
		}
		public int Capacity
		{
			get;
			private set;
		}
		public int this[int pos]
		{
			get
			{
				if (pos < 0 || pos >= Size)
				{
					Console.WriteLine("索引越界！");
					Environment.Exit(-1);
				}
				return arr_[pos];
			}
			set
			{
				if (pos < 0 || pos >= Size)
				{
					Console.WriteLine("索引越界！");
					Environment.Exit(-1);
				}
				arr_[pos] = value;
			}
		}
		public void Insert(int pos, int val)
		{
			if (pos < 0 || pos > Size)
			{
				Console.WriteLine("索引越界！");
				Environment.Exit(-1);
			}
			if (Size == Capacity)
			{
				int newCapacity = Capacity == 0 ? 4 : Capacity * 2;
				int[] temp = new int[newCapacity];
				for (int i = 0; i < Size; ++i)
					temp[i] = arr_[i];
				arr_ = temp;
				Capacity = newCapacity;
			}
			for (int i = Size; i > pos; --i)
				arr_[i] = arr_[i - 1];
			arr_[pos] = val;
			Size++;
		}
		public void Erase(int pos)
		{
			if (pos < 0 || pos > Size)
			{
				Console.WriteLine("索引越界！");
				Environment.Exit(-1);
			}
			if (Size == 0)
			{
				Console.WriteLine("数组为空！");
				return;
			}
			for (int i = pos; i < Size - 1; ++i)
				arr_[i] = arr_[i + 1];
			Size--;
		}
		public void PushBack(int val)
		{
			Insert(Size, val);
		}
		public void PopBack()
		{
			Erase(Size - 1);
		}
		public int Find(int val)
		{
			for (int i = 0; i < Size; ++i)
				if (arr_[i] == val)
					return i;
			return -1;
		}

		public void show()
		{
			for (int i = 0; i < Size; ++i)
				Console.Write(arr_[i] + " ");
			Console.WriteLine();
		}
	}
	//class B
	//{
	//	public static B test_ = new B();
	//	public int data_;
	//	private B() { }
	//	public static B Test
	//	{
	//		get { return test_; }
	//	}
	//	public static B GetInstance()
	//	{
	//		return test_;
	//	}
	//}

	//class A
	//{
	//	public int a_;
	//	private int b_;
	//	public static int c_;
	//	public const int d_ = 10;
	//	public static void func()
	//	{
	//		Console.WriteLine(c_);
	//		Console.WriteLine(d_);
	//	}
	//}

	//static class C
	//{
	//	static int c1_ = 1;
	//	static int c2_ = 1;
	//	static C()
	//	{
	//		Console.WriteLine("static C()");
	//	}
	//}
	//class D
	//{
	//	static int c1_ = 1;
	//	static int c2_ = 1;
	//	public int c4;
	//	public int c5;
	//	static D()
	//	{
	//		Console.WriteLine("static D()");
	//	}
	//	public D()
	//	{
	//		Console.WriteLine("public D()");
	//	}
	//}
	static class Util
	{
		public static void func(this int value)
		{
			Console.WriteLine("拓展方法 int::func");
		}
		public static void func(this int value, string name)
		{
			Console.WriteLine("拓展方法 int::func" + name);
		}
		public static void func3(this People p)
		{
			Console.WriteLine("拓展方法 People::func3");
		}

	}
	class People
	{
		private string name_;
		public string Name{
			get
			{
				return name_;
			}
			set
			{
				name_ = value;
			}
		}
		public void func1()
		{
			Console.WriteLine("成员方法 People::func1");
		}
		public void func2()
		{
			Console.WriteLine("成员方法 People::func2");
		}
		public static People operator+(People p1, People p2)
		{
			People temp = new People();
			temp.Name = p1.name_ + " " + p2.name_;
			return temp;
		}
	}

	//class Base
	//{
	//	public int a_;
	//	protected int b_;
	//	private int c_;
	//	internal int d_;
	//	public Base()
	//	{
	//		 Console.WriteLine("Base()");
	//	}
		
	//}
	//class Derived : Base
	//{
	//	// 基类的a_被隐藏，new可加可不加，建议加
	//	public new int a_;
	//	public Derived()
	//	{
	//		 Console.WriteLine("Derived()");
	//	}
	//}
	//class GameObject
	//{
	//	public string Name
	//	{
	//		get;
	//		set;
	//	}
	//}
	//class Player : GameObject
	//{
	//	public Player()
	//	{
	//		Name = "Player";
	//	}
	//	public void Speak()
	//	{
	//		 Console.WriteLine("{0} Speak", Name);
	//	}
	//}
	//class Enemy : GameObject
	//{
	//	public Enemy()
	//	{
	//		Name = "Enemy";
	//	}
	//	public void Attack()
	//	{
	//		 Console.WriteLine("{0} Attack", Name);
	//	}
	//}
	//class Map : GameObject
	//{
	//	public Map()
	//	{
	//		Name = "Map";
	//	}
	//	public void Show()
	//	{
	//		 Console.WriteLine("{0} Show", Name);
	//	}
	//}
	//class Weapon
	//{
	//	public string Name
	//	{
	//		get;
	//		set;
	//	}
	//}
	//class SubmachineGun : Weapon
	//{
	//	public SubmachineGun()
	//	{
	//		Name = "SMG";
	//	}
	//	public void Fire()
	//	{
	//		 Console.WriteLine("{0} Fire", Name);
	//	}
	//}
	//class ShotGun : Weapon
	//{
	//	 public ShotGun()
	//	{
	//		Name = "ShotGun";
	//	}
	//	 public void Fire()
	//	{
	//		 Console.WriteLine("{0} Fire", Name);
	//	}
	//}
	//class Pistol : Weapon
	//{
	//	 public Pistol()
	//	{
	//		Name = "Pistol";
	//	}
	//	public void Fire()
	//	{
	//		 Console.WriteLine("{0} Fire", Name);
	//	}
	//}
	//class Dagger : Weapon
	//{
	//	 public Dagger()
	//	{
	//		Name = "Dagger";
	//	}
	//	 public void Attack()
	//	{
	//		 Console.WriteLine("{0} Attack", Name);
	//	}
	//}
	//class Player
	//{
	//	private Weapon weapon_ = new Pistol();
	//	public void PickUp(Weapon weapon)
	//	{
	//		weapon_ = weapon;
	//	}
	//	public void Attack()
	//	{
	//		if (weapon_ is SubmachineGun)
	//		{
	//			(weapon_ as SubmachineGun).Fire();
	//		}
	//		else if (weapon_ is ShotGun)
	//		{
	//			(weapon_ as ShotGun).Fire();
	//		}
	//		else if (weapon_ is Pistol)
	//		{
	//			(weapon_ as Pistol).Fire();
	//		}
	//		else if (weapon_ is Dagger)
	//		{
	//			(weapon_ as Dagger).Attack();
	//		}
	//	}
	//}
	//class Base
	//{
	//	public Base()
	//	{
	//		Console.WriteLine("Base()");
	//	}
	//	public Base(int i) : this()
	//	{
	//		Console.WriteLine("Base(i)");
	//	}
	//}
	//class Derive : Base
	//{
	//	public Derive() : base()
	//	{
	//		Console.WriteLine("Derive()");
	//	}
	//	public Derive(int i) : base(i)
	//	{
	//		Console.WriteLine("Derive(i)");
	//	}
	//}
	//class Laborer
	//{
	//	public Laborer(string workType, string workContent)
	//	{
	//		Console.WriteLine("public Laborer(string workType, string workContent)");
	//		WorkType = workType;
	//		WorkContent = workContent;
	//	}
	//	public string WorkType
	//	{ get; set; }
	//	public string WorkContent
	//	{ get; set; }
	//	public void Work()
	//	{
	//		Console.WriteLine("{0} {1}", WorkType, WorkContent);
	//	}
	//}
	//class Programmer : Laborer
	//{
	//	public Programmer() : base("Programmer", "Coding")
	//	{
	//		Console.WriteLine("public Programmer()");
	//	}
	//}
	//class Planner : Laborer
	//{
	//	public Planner() : base("Planner", "Write")
	//	{
	//		Console.WriteLine("public Planner()");
	//	}
	//}
	//class Art : Laborer
	//{
	//	public Art() : base("Art", "Draw")
	//	{
	//		Console.WriteLine("public Art()");
	//	}
	//}

	//class Person
	//{
	//	public Person(string name)
	//	{
	//		Name = name;
	//	}
	//	public string Name { get; set; }

	//}
	//class Driver : Person
	//{
	//	public Driver(string name) : base(name)
	//	{

	//	}
	//	public void Drive()
	//	{
	//		Console.WriteLine("{0} Drive", Name);
	//	}
	//}
	//class Customer : Person
	//{
	//	public Customer(string name) : base(name)
	//	{

	//	}
	//	public void Consume()
	//	{
	//		Console.WriteLine("{0} Custom", Name);
	//	}
	//}

	//class Carrier
	//{

	//	private float speed_;
	//	private float maxSpeed_;
	//	private int availableCarryNumber_;
	//	private int count_;
	//	public Driver Driver_ { get; set;}
	//	private Person[] customers_;
	//	public Person this[int index]
	//	{
	//		get
	//		{
	//			if (index < 0 || index >= availableCarryNumber_)
	//			{
	//				Console.WriteLine("public Customer this[int index] get");
	//				 Environment.Exit(-1);
	//			}
	//			return customers_[index];
	//		}
	//		set
	//		{
	//			if (index < 0 || index >= availableCarryNumber_)
	//			{
	//				Console.WriteLine("public Customer this[int index] set");
	//				Environment.Exit(-1);
	//			}
	//			customers_[index] = value;
	//		}
	//	}
	//	public float Speed
	//	{
	//		get
	//		{
	//			 return speed_;
	//		}
	//		set
	//		{
	//			 speed_ = value;
	//		}
	//	}
	//	public float MaxSpeed
	//	{
	//		get
	//		{
	//			return maxSpeed_;
	//		}
	//		set
	//		{
	//			maxSpeed_ = value;
	//		}
	//	}
	//	public int AvailableCarryNumber
	//	{
	//		get
	//		{
	//			return availableCarryNumber_;
	//		}
	//		set
	//		{
	//			availableCarryNumber_ = value;
	//		}
	//	}
	//	public int Count
	//	{
	//		get
	//		{
	//			return count_;
	//		}
	//		private set
	//		{
	//			count_ = value;
	//		}
	//	}
	//	public Carrier()
	//	{
	//		Speed = 0;
	//		speed_ = 0;
	//		MaxSpeed = 100;
	//		maxSpeed_ = 100;
	//		AvailableCarryNumber = 10;
	//		availableCarryNumber_ = 10;
	//		count_ = 0;
	//		count_ = 0;
	//		customers_ = new Customer[availableCarryNumber_];
	//	}
	//	public void GetOn(Person person)
	//	{
	//		if (person is Driver)
	//		{
	//			Driver_ = person as Driver;
	//		}
	//		else
	//		{
	//			if (Count == AvailableCarryNumber)
	//			{
	//				Console.WriteLine("Carrier Full");
	//				return;
	//			}
	//			customers_[Count++] = person as Customer;

	//		}
	//		Console.WriteLine("{0} Get On", person.Name);
	//	}
	//	public void GetOff(Person person)
	//	{
	//		if (person is Driver)
	//		{
	//			Driver_ = null;
	//			Console.WriteLine("{0} Get Off", person.Name);
	//		}
	//		else
	//		{
	//			for (int i = 0; i < Count; i++)
	//			{
	//				if (customers_[i] == person)
	//				{
	//					customers_[i] = null;
	//					customers_[i] = customers_[--Count];
	//					customers_[Count] = null;
	//					Console.WriteLine("{0} Get Off", person.Name);
	//					return;
	//				}
	//			}

	//		}

	//	}
	//	public void run()
	//	{
	//		Driver_.Drive();
	//		Console.WriteLine("{0} run", Driver_.Name);
	//	}
	//	public void CarAccident(Carrier other)
	//	{
	//		if (this == other) return;
	//		Console.WriteLine("{0} 和 {1} Car Accident", Driver_.Name, other.Driver_.Name);
	//	}

	//}

	//class Base
	//{
	//	public virtual void Print()
	//	{
	//		Console.WriteLine("Base");
	//	}
	//	public void Speak()
	//	{
	//		Console.WriteLine("Base Speak");
	//	}
	//}
	//class Derive : Base
	//{

	//	//public override void Print()
	//	//{
	//	//	base.Print();
	//	//	Console.WriteLine("Derive");
	//	//}
	//	public new void Speak()
	//	{
	//		Console.WriteLine("Derive Speak");
	//	}
	//}

	//abstract class Base
	//{
	//	public string Name { get; set; }
	//	public abstract void Print();
	//	public void Speak()
	//	{
	//		Console.WriteLine("Base Speak " + Name);
	//	}
	//}
	//abstract class Derive : Base
	//{
	//	public abstract void Func();
	//	public Derive()
	//	{
	//		Name = "Derive";
	//	}
	//	public override void Print()
	//	{
	//		Console.WriteLine("override Derive");
	//	}
	//}
	//class Derive2 : Derive
	//{
	//	public override void Func()
	//	{
	//		Console.WriteLine("Func");
	//	}
	//	public override void Print()
	//	{
	//		Console.WriteLine("override Derive2");
	//	}
	//}
	//abstract class Animal
	//{
	//	public abstract void Shout();
	//}
	//class Person : Animal
	//{
	//	public override void Shout()
	//	{
	//		Console.WriteLine("Person Shout");
	//	}
	//}
	//class Dog : Animal
	//{
	//	public override void Shout()
	//	{
	//		Console.WriteLine("Dog Shout");
	//	}
	//}
	//class Cat : Animal
	//{
	//	public override void Shout()
	//	{
	//		Console.WriteLine("Cat Shout");
	//	}
	//}

	//abstract class Graph
	//{
	//	public abstract float Area();
	//	public abstract float Perimeter();
	//}
	//class Matrix : Graph
	//{
	//	public Matrix(int length, int width){
	//		Length = length;
	//		Width = width;
	//	}
	//	public int Length { get; set; }
	//	public int Width { get; set; }
	//	public override float Area()
	//	{
	//		return Length * Width;
	//	}
	//	public override float Perimeter()
	//	{
	//		return Length * 2 + Width * 2;
	//	}
	//}
	//class Square : Graph
	//{
	//	public Square(int side)
	//	{
	//		Side = side;
	//	}
	//	public int Side { get; set; }

	//	public override float Area()
	//	{
	//		return Side * Side;
	//	}
	//	public override float Perimeter()
	//	{
	//		return Side * 4;
	//	}
	//}
	//class Circular : Graph
	//{
	//	public Circular(float radius)
	//	{
	//		Radius = radius;
	//	}
	//	private float Pi = 3.14f;
	//	public float Radius { get; set; }
	//	public override float Area()
	//	{
	//		return (int)(Pi * Radius * Radius);
	//	}
	//	public override float Perimeter()
	//	{
	//		return (int)(2 * Pi * Radius);
	//	}
	//}

	//interface IFly
	//{
	//	// 成员方法
	//	void Fly();
	//	// 属性
	//	string Name { get; set; }
	//	// 索引器
	//	int this[int pos] { get; set; }
	//	// 事件
	//	//event EventHandler OnFly;
	//}
	//class Animal
	//{

	//}
	//class Bird : Animal, IFly
	//{
	//	public virtual void Fly()
	//	{
	//		Console.WriteLine("Bird Fly " + Name);
	//	}
	//	public string Name { get; set; }
	//	public int this[int pos]
	//	{
	//		get
	//		{
	//			return pos;
	//		}
	//		set
	//		{
	//			Console.WriteLine("Bird Set Index");
	//		}
	//	}

	//}

	//interface INormalAtk
	//{
	//	void Atk();
	//}
	//interface ISuperAtk
	//{
	//	void Atk();
	//}
	//class Person : INormalAtk, ISuperAtk
	//{
	//	// 这个Atk函数与接口的Atk都不同，不构成重载
	//	public void Atk()
	//	{
	//		Console.WriteLine("Person Atk");
	//	}
	//	// 显式实现接口成员函数时，不需要写访问修饰符
	//	void INormalAtk.Atk()
	//	{
	//		 Console.WriteLine("Person Super Atk");
	//	}
	//	// 显式实现接口成员函数时，不需要写访问修饰符
	//	void ISuperAtk.Atk()
	//	{
	//		 Console.WriteLine("Person Super Atk");
	//	}
	//}

	//class Base
	//{
	//	public virtual void Print()
	//	{
	//		Console.WriteLine("Base");
	//	}
	//}
	//class Derive1 : Base
	//{
	//	public sealed override void Print()
	//	{
	//		Console.WriteLine("Derive");
	//	}
	//}
	//class Derive2 : Derive1
	//{
	//	public override void Print()
	//	{
	//		Console.WriteLine("Derive");
	//	}
	//}
	//class A
	//{
	//	public char[] str_ = new char[5] { '1', '2', '3', '4', '5'};
	//	public A Clone()
	//	{
	//		return MemberwiseClone() as A;
	//	}
	//}
	//struct B
	//{
	//	public char[] str_;
	//	public B Clone()
	//	{
	//		return (B)MemberwiseClone();
	//	}
	//}

	//class Player
	//{
	//	private string name_;
	//	private float hp_;
	//	private int atk_;
	//	private int def_;
	//	private int money_;
	//	public Player(string name, float hp, int atk, int def, int money)
	//	{
	//		name_ = name;
	//		hp_ = hp;
	//		atk_ = atk;
	//		def_ = def;
	//		money_ = money;
	//	}
	//	public override string ToString()
	//	{
	//		return string.Format("name:{0}, hp:{1}, atk:{2}, def:{3}, money:{4}",
	//			name_, hp_, atk_, def_, money_);
	//	}
	//}
	//class Monster
	//{
	//	private string name_;
	//	private float hp_;
	//	private int atk_;
	//	private int def_;
	//	private string skill_;
	//	public Monster(string name, float hp, int atk, int def, string skill)
	//	{
	//		name_ = name;
	//		hp_ = hp;
	//		atk_ = atk;
	//		def_ = def;
	//		skill_ = skill;
	//	}
	//	public override string ToString()
	//	{
	//		return string.Format("name:{0}, hp:{1}, atk:{2}, def:{3}, skill:{4}",
	//			name_, hp_, atk_, def_, skill_);
	//	}
	//	public Monster Clone()
	//	{
	//		return MemberwiseClone() as Monster;
	//	}
	//}
	class Program
	{
		static void Main(string[] args)
		{
			string s = new string("123456");
			
			//StringBuilder sb = new StringBuilder("123456", 16);

			//string s1 = "  1,2,3,3,4,5  ";
			//char[] arr = s1.ToCharArray();
			//foreach (var item in arr)
			//{
			//	Console.Write(item + " ");
			//}
			//Console.WriteLine();
			//Console.WriteLine(s1);

			//string s2 = string.Format("{0:D}", 123);
			//Console.WriteLine(s2);
			//int idx = s1.IndexOf('3');
			//Console.WriteLine(idx);
			//idx = s1.IndexOf('9');
			//Console.WriteLine(idx);
			//idx = s1.LastIndexOf('3');
			//Console.WriteLine(idx);

			//string s3 = s1.Remove(3);
			//Console.WriteLine(s3);
			//s3 = s1.Remove(3, 2);
			//Console.WriteLine(s3);

			//string s4 = s1.Replace('3', '9');
			//Console.WriteLine(s4);
			//s4 = s1.Replace("123", "999");
			//Console.WriteLine(s4);

			//string[] s5 = s1.Split(',');
			//foreach (var item in s5)
			//{
			//	Console.WriteLine(item);
			//}
			//Console.WriteLine(s1);
			//string s6 = s1.Substring(2);
			//Console.WriteLine(s6);
			//s6 = s1.Substring(2, 2);
			//Console.WriteLine(s6);
			////s6 = s1.Substring(2, 30);
			////Console.WriteLine(s6);

			//string s7 = s1.ToUpper();
			//Console.WriteLine(s7);
			//string s8 = s1.ToLower();
			//Console.WriteLine(s8);

			//string s9 = s1.Trim();
			//Console.WriteLine(s9);
			//string s10 = "11111111111";
			//Console.WriteLine(s10.Trim('1'));
			//Player p1 = new Player("Tom", 100, 10, 5, 1000);
			//Console.WriteLine(p1);

			//A a = new A();
			//Console.WriteLine(a.ToString());
			//Console.WriteLine(1.ToString());
			//Console.WriteLine(3.1451.ToString());

			//A a1 = new A();
			//A a2 = a1.Clone();
			//Console.WriteLine(a1.str_);
			//Console.WriteLine(a2.str_);
			//a2.str_[0] = '&';
			//Console.WriteLine(a1.str_);
			//Console.WriteLine(a2.str_);


			//B b1 = new B();
			//b1.str_ = new char[5] { '1', '2', '3', '4', '5'};
			//B b2 = b1.Clone();
			//Console.WriteLine(b1.str_);
			//Console.WriteLine(b2.str_);
			//b2.str_[0] = '&';
			//Console.WriteLine(b1.str_);
			//Console.WriteLine(b2.str_);

			//A a1 = new A();
			//A a2 = new A();
			//a2 = a1;
			//Console.WriteLine(ReferenceEquals(1, 1));
			//Console.WriteLine(ReferenceEquals(a1, a2));
			//Console.WriteLine(ReferenceEquals(a1, 1));

			//object

			//Person p = new Person();
			//p.Atk();
			//(p as INormalAtk).Atk();
			//(p as ISuperAtk).Atk();

			//IFly ifly = new Bird();
			//ifly.Name = "Birdssss";
			//ifly.Fly();
			//Console.WriteLine(ifly[100]);
			//ifly[99] = 100;

			//Animal animal = new Person();
			//animal.Shout();

			//animal = new Dog();
			//animal.Shout();

			//animal = new Cat();
			//animal.Shout();

			//Graph graph = new Matrix(10, 20);
			//Console.WriteLine(graph.Area());
			//Console.WriteLine(graph.Perimeter());

			//graph = new Square(10);
			//Console.WriteLine(graph.Area());
			//Console.WriteLine(graph.Perimeter());

			//graph = new Circular(10);
			//Console.WriteLine(graph.Area());
			//Console.WriteLine(graph.Perimeter());

			//Base b1 = new Derive2();
			//b1.Print();
			//b1.Speak();
			//(b1 as Derive).Func();
			//Base b = new Derive();
			//b.Print();
			//b.Speak();

			//Base b1 = new Base();
			//b1.Print();
			//Base b2 = new Derive();
			//b2.Print();

			//b1.Speak();
			//b2.Speak();
			//(b2 as Derive).Speak();
			//Carrier car = new Carrier();
			//car.Driver_ = new Driver("Jack");
			//Random r = new Random();
			//int select;
			//Customer[] customs = new Customer[car.AvailableCarryNumber];
			//for (int i = 0; i < car.AvailableCarryNumber; i++)
			//{
			//	customs[i] = new Customer("Customer" + i);
			//	car.GetOn(customs[i]);
			//}
			//car.run();
			//for (int i = 0; i < car.AvailableCarryNumber; i++)
			//{
			//	car.GetOff(customs[i]);
			//}
			//Carrier other = new Carrier();
			//other.Driver_ = new Driver("Tom");
			//car.CarAccident(other);

			//int val = 10;
			//// 装箱
			//object obj = val;
			//// 拆箱
			//val = (int)obj;

			//string str = "123";
			//// 装箱
			//obj = str;
			//// 拆箱
			//str = (string)obj;
			//str = obj as string;
			//str = obj.ToString();

			//int[] arr = new int[10];
			//obj = arr;
			//arr = (int[])obj;
			//arr = obj as int[];

			//Programmer pr = new Programmer();
			//Planner pl = new Planner();
			//Art art = new Art();

			//Derive d = new Derive();
			//d = new Derive(1);
			//Player p = new Player();
			//p.Attack();
			//p.PickUp(new SubmachineGun());
			//p.Attack();
			//p.PickUp(new ShotGun());
			//p.Attack();
			//p.PickUp(new Dagger());
			//p.Attack();

			//GameObject[] objs = new GameObject[] { 
			//	new Player(), new Enemy(), new Map() };
			//for (int i = 0; i < objs.Length; i++)
			//{
			//	if (objs[i] is Player)
			//	{
			//		(objs[i] as Player).Speak();
			//	}
			//	else if (objs[i] is Enemy)
			//	{
			//		(objs[i] as Enemy).Attack();
			//	}
			//	else if (objs[i] is Map)
			//	{
			//		(objs[i] as Map).Show();
			//	}
			//}


			//Derived d = new Derived();
			//Console.WriteLine(d.a_);
			//Console.WriteLine(d.a_);


			//People p1 = new People();
			//People p2 = new People();
			//p1.Name = "张三";
			//p2.Name = "李四";
			//People p3 = p1 + p2;
			//Console.WriteLine(p3.Name);

			//People p = new People();
			//p.func1();
			//p.func2();
			//p.func3();

			//int a = 10;
			//a.func();
			//a.func("初音未来");

			//Student s = new Student();
			//s.Name = "张三";
			//s.Gender = " ";
			//s.Age = 1800;
			//s.Score1 = 9000;
			//s.Score2 = 85000;
			////s.Hello();
			////s.ShowScore();
			//s[0] = new Student();
			//s[0].Name = "李四";
			//s[0, 0] = new Student();
			//s[0, 0].Name = "王五";
			//Console.WriteLine(s[0].Name);
			//Console.WriteLine(s[0, 0].Name);

			//Student s = new Student();
			//Student s = new Student("dasd");

			//s[0] = new Student();
			////s[0].Name = "李四";
			//s[0, 0] = new Student();
			////s[0, 0].Name = "王五";
			//Console.WriteLine(s[0].Name);
			//Console.WriteLine(s[0, 0].Name);


			//Position pos = new Position(10, 20);

			//MyArray arr = new MyArray();
			//arr.PushBack(0);
			//arr.PushBack(1);
			//arr.PushBack(2);
			//arr.PushBack(3);
			//arr.show();
			//int pos = arr.Find(2);
			//if (pos!= -1)
			//{
			//	Console.WriteLine();
			//	arr.Erase(pos);
			//}
			//arr[0] = 100;
			//arr.show();

			//Console.WriteLine(A.c_);
			//Console.WriteLine(A.d_);
			//A.func();

			////B.GetInstance().data_ = 10;
			////B b = B.GetInstance();
			////b = null;
			//Console.WriteLine(B.Test.data_);
			////B.Test = null;


		}
	}
}
